// 1.类型别名

// let sum: (x:number, y:number) => number
// const ret = sum(1,2)

// type PlusType = (x:number, y:number) => number
// let sum2: PlusType
// const ret2 = sum(2,3)

type StrOrNumber = string | number

let ret3: StrOrNumber = '123'
ret3 = 123
ret3 = "abc"


// 2.字面量(字符串，数字，布尔)
const str: 'name' = 'name'
const number: 1 = 1
const bool: false = false

// 字符串字面量
type Directions = 'Up' | 'Down' | 'Left' | 'Right'
// let toWhere: Directions = 输入的时候提示 Directions内容
let toWhere: Directions = "Up"

// 3.交叉类型
interface IName {
  name: string
}

type IPerson = IName & { age: number }
let person: IPerson = { name: '123', age: 123 }

